
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @module cr.session
* @author: Hjava
* @description: 直播模块消息外包
* @since: 2018-07-21 17:02:14
*/
var cr_constant_1 = __webpack_require__(/*! _chatroom/cr.constant */ "./src/core/chatroom/cr.constant.ts");
var protocol_1 = __webpack_require__(/*! _util/protocol */ "./src/core/utils/protocol.ts");
var bufferType_1 = __webpack_require__(/*! _util/bufferType */ "./src/core/utils/bufferType.ts");
var deviceInfo_1 = __webpack_require__(/*! _util/deviceInfo */ "./src/core/utils/deviceInfo.ts");
var uuid_1 = __webpack_require__(/*! _util/uuid */ "./src/core/utils/uuid.ts");
var timer_1 = __webpack_require__(/*! _util/timer */ "./src/core/utils/timer.ts");
var CRSession = {};
CRSession.CRSendReq = protocol_1.default.Response.extend({
    category: 'LIVE',
    uri: cr_constant_1.default.CR.URI_CR_SEND_MSG,
    init: function () {
        this.deviceType = deviceInfo_1.default.deviceType;
        this.uuid = uuid_1.default.next();
        this.fromUid = '';
        this.crId = '';
        this.type;
        this.message;
        this.fromName = '';
        this.cts = timer_1.default.get();
        this.mid = '';
        this.extension = '';
        this.priority = 0;
    },
    marshall: function () {
        this.push(this.deviceType, bufferType_1.default.BYTE);
        this.push(this.uuid, bufferType_1.default.STRING);
        this.push(this.fromUid, bufferType_1.default.LONG);
        this.push(this.crId, bufferType_1.default.LONG);
        this.push(this.type); //消息类型
        this.push(this.message);
        this.push(this.fromName, bufferType_1.default.STRING);
        this.push(this.cts, bufferType_1.default.LONG);
        this.push(this.mid, bufferType_1.default.LONG);
        this.push(this.extension, bufferType_1.default.STRING);
        this.push(this.priority, bufferType_1.default.SHORT);
    },
    unmarshall: function () {
        this.deviceType = this.popByte();
        this.uuid = this.popString();
        this.fromUid = this.popLong().value();
        this.crId = this.popLong().value();
        this.type = this.popInt();
        this.message = protocol_1.default.Message.fromBuffer(this.popBytes());
        this.fromName = this.popString();
        this.cts = this.popLong().value();
        this.mid = this.popLong().value();
        this.extension = this.popString();
        this.priority = this.popShort();
    }
});
CRSession.CRAck = protocol_1.default.Response.extend({
    category: 'LIVE',
    uri: cr_constant_1.default.CR.URI_CR_SEND_MSG_RES,
    init: function () {
        this.uuid = '';
        this.mid = 0;
        this.cts = timer_1.default.get();
        this.rescode = 0;
        this.deviceType = deviceInfo_1.default.deviceType;
    },
    marshall: function () {
        this.push(this.uuid, bufferType_1.default.STRING);
        this.push(this.mid, bufferType_1.default.LONG);
        this.push(this.cts, bufferType_1.default.LONG);
        this.push(this.rescode, bufferType_1.default.INT);
        this.push(this.deviceType, bufferType_1.default.BYTE);
    },
    unmarshall: function () {
        this.uuid = this.popString();
        this.mid = this.popLong().value();
        this.cts = this.popLong().value();
        this.rescode = this.popInt();
        this.deviceType = this.popByte();
    }
});
CRSession.notice = protocol_1.default.Response.extend({
    category: 'LIVE',
    uri: cr_constant_1.default.CR.URI_CR_NOTICE,
    init: function () {
        this.toUid = '';
        this.crId = '';
        this.type = 0;
        this.data = '';
        this.cts = timer_1.default.get();
    },
    marshall: function () {
        this.push(this.toUid, bufferType_1.default.LONG);
        this.push(this.crId, bufferType_1.default.LONG);
        this.push(this.type, bufferType_1.default.INT);
        this.push(this.data, bufferType_1.default.STRING);
        this.push(this.cts, bufferType_1.default.LONG);
    },
    unmarshall: function () {
        this.toUid = this.popLong().value();
        this.crId = this.popLong().value();
        this.type = this.popInt();
        this.data = this.popString();
        this.cts = this.popLong().value();
    }
});
exports.default = CRSession;


//# sourceURL=webpack://MTDX/./src/core/chatroom/cr.session.ts?